#ifndef SP_DRIVER_SERIAL_H
#define SP_DRIVER_SERIAL_H

#include <io.h>
#include <klibc/ctype.h>
#include <system/regs.h>
#include <system/mod.h>

#define COM1 0x3f8
#define COM2 COM1 + 1
#define COM3 COM2 + 1
#define COM4 COM3 + 1



extern module_t serial_module;



typedef struct
{
	char buf[256];
	uint8_t size;
	uint8_t where;
	uint8_t point;	
} serial_buf_t;


serial_buf_t combuf[4];

uint32_t serial_init();
void serial_init_port(uint32_t);
void serial_send(uint32_t, uint8_t);
uint8_t serial_receive(uint32_t);
static void serial_callback(regs_t *);
uint32_t serial_shut();
uint32_t serial_read(struct file *, uint8_t *, uint32_t, uint64_t);
uint32_t serial_write(struct file *, uint8_t *, uint32_t, uint64_t);

#endif
